package com.kevin.training.meal.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/**/*.cgi")
public class ViewController {

	private Logger logger = Logger.getLogger(ViewController.class);

	@RequestMapping
	public String getPage(HttpServletRequest request) {
//		ApplicationContext context = RequestContextUtils.getWebApplicationContext(request);
		String uri = request.getRequestURI();
		uri = uri.substring(request.getContextPath().length() + 1, uri.length() - 4);
		logger.info("Request page logic name: " + uri);
		return uri;
	}
}
